<template>
  <div class="water">
    <div class="water-top-sty">
      <ul class="water-ul">
        <li v-for="(item,index) in newArrayTop" :key="index">
          <span class="icon-sty">
            <img src="../images/sc.png" />
          </span>
          <span class="water-title">{{item.deviceTypeName}}</span>
          <span class="water-digt">{{item.deviceCount}}</span>
        </li>
      </ul>
    </div>
    <div class="water-bottom-sty">
      <ul class="water-ul">
        <li v-for="(item,index) in newArrayBom" :key="index">
          <span class="icon-sty">
            <img src="../images/sz.png" />
          </span>
          <span class="water-title">{{item.deviceTypeName}}</span>
          <span class="water-digt">{{item.deviceCount}}</span>
        </li>
      </ul>
    </div>
  </div>
  <!--<map-box style="position:absolute;height: 78vh;width: 94vw;top: 0;left: 0;"></map-box>-->
</template>

<script>
import { overview } from "@/api/monitor"; // 不同模块的api 分开放，
import MapBox from "@/components/map";

export default {
  name: "monitor",
  components: {
    MapBox
  },
  data() {
    return {
      isShow: [],
      tableData:[],
      newArrayTop:[],
      newArrayBom:[]
    };
  },
  mounted() {
    const that = this;
    overview({}).then(res => {
      var resultData = res.data;
      console.log(resultData +'1');
      // 处理拿到的数据理拿到的数据
      this.tableData = resultData;
      const newArrayTop =[],newArrayBom =[]
       if (resultData.length > 0) {
         for (let i = 0; i < resultData.length; i++) {
           i < 6 ? newArrayTop.push(resultData[i]): newArrayBom.push(resultData[i])
         }
         console.log(newArrayTop)
         console.log(newArrayBom)
         this.newArrayTop = newArrayTop
         this.newArrayBom = newArrayBom
       }
    });
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
// .water{
//   position: relative;
// }
.water-top-sty {
  display: block;
  height: 49%;
  width: 100%;
  border: 1.2px solid #0cf;
  background: #2c4972;
  -webkit-box-shadow: 0 0 0.5rem #1800ff;
  box-shadow: 0 0 0.5rem #1800ff;
}
.water-bottom-sty {
  display: block;
  height: 49%;
  width: 100%;
  margin-top: 1%;
  border: 1.2px solid #0cf;
  background: #032657;
  -webkit-box-shadow: 0 0 0.5rem #1800ff;
  box-shadow: 0 0 0.5rem #1800ff;
}
.water-ul {
  height: 100%;
  //display: flex;
  align-items: center;
}
.water-ul li {
  display: inline-block;
  width: calc(23.33333% - 0.66667px);
  position: relative;
  margin: 1rem 1rem 0 1rem;
}
.icon-sty img {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-block;
  vertical-align: middle;
}
.water-title {
  color: #0cf;
  font-size: 1rem;
}
.water-digt {
  color: #fff;
  font-size: 1.22rem;
  position: absolute;
  right: 0;
}
</style>
